function TLTlDlg(what_to_update)

% SYNTAX:
%   TLTlDlg(what_to_update)
% 
% DESCRIPTION:
%    Function updates TargetLink main dialog windows (if there are any),
%    and deletes unrelated SF data object dialogs.
%
% INPUT ARGUMENTS
%   what_to_update           'simulation_display' or 'TL_subs_display'
%
% OUTPUT ARGUMENTS:
%   -/-
%
% EXAMPLE
%   -/-
%
% SEE ALSO
%   -/-
%
% REMARK
%   -/-

% Author(s): C. Witte
% since: 1998-01-01
% $RCSfile: TLTlDlg.m $
% $ProjectName: e:/ARC/Components/HostSW/SimulinkBlocksets/TLBlocksets/CommonBlockset/CommonBlockset_UtilityBlocksUI/Sources/MSrc/project.pj $
% $Revision: 1.4 $
% $Date: 2010/07/22 09:26:50MESZ $
%
% Copyright (c) 2010 dSPACE GmbH. All rights reserved.


% find all TL dialogs
hDlgs = ds_find_dialogs('TargetLink Block Dialog');

for i=1:numel(hDlgs)
    % main dialog ?
    if ~isempty(findstr(get(hDlgs(i),'Name'),'TargetLink Main Dialog'))
        tl_maindialog_dlg('Update',hDlgs(i),what_to_update);
    end
    
    % delete unrelated SF Object dialogs
    if strcmp('TL_subs_display',what_to_update)
        dlgdata = get(hDlgs(i),'UserData');
        if dlgdata.bIsSFOrEMLObject && ~ds_isa(dlgdata.model,'sfobject')
            delete(hDlgs(i));
        end    
    end
end
